define(
    [
        'require',
        'broada/ui/dialog'
    ],
    function(require){
        var ConfigSysinfoView = Ember.View.extend({
            classNames: "config-sysinfo",
            didInsertElement: function(){
               
            },
            Dialog: require('broada/ui/dialog'),
            TimeInput: Ember.TextField.extend({
                keyDown: function(e){
                    if ((e.keyCode>=48 && e.keyCode<=57) || (e.keyCode>=96 && e.keyCode<=105)||e.keyCode==8||e.keyCode==46){
                        return true;                      
                    }else{
                        return false;
                    }             
                }
            }),
            MIInput: Ember.TextField.extend({
                keyDown: function(e){
                    if ((e.keyCode>=48 && e.keyCode<=57) || (e.keyCode>=96 && e.keyCode<=105)||e.keyCode==8||e.keyCode==46||e.keyCode==110||e.keyCode==190){
                        return true;                      
                    }else{
                        return false;
                    }             
                }
            }),
        });
        Ember.Handlebars.registerBoundHelper('formatavgload', function(avgload, options){
            var r_avgload = avgload+'%';
            return r_avgload;
        });
        Ember.Handlebars.registerBoundHelper('formatusage', function(usage, options){
            var r_usage = (usage*100).toFixed(0)+'%';
            return r_usage;
        });
        Ember.Handlebars.registerBoundHelper('formattime', function(time, options){
            return APM.util.formatDate(new Date(parseInt(time)), 'HH:mm:ss');
        });
        Ember.Handlebars.registerBoundHelper('formatmemtotal', function(total, options){
            return (total/1024/1024).toFixed(2) + "G";
        });
        Ember.Handlebars.registerBoundHelper('formattotal', function(total, options){
            return APM.util.flowFormatter(total*1024);//磁盘、内存默认单位KB
        });
        Ember.Handlebars.registerBoundHelper('formatrxPackage', function(rxPackage, options){
            var r_rxPackage = rxPackage+"包";
            return r_rxPackage;
        });
        Ember.Handlebars.registerBoundHelper('formatrxPackageRate', function(rxPackageRate, options){
            var r_rxPackageRate = APM.util.flowFormatter(rxPackageRate);
            return r_rxPackageRate==0?0:r_rxPackageRate.toString().replace("B","")+"pps";
        });
        Ember.Handlebars.registerBoundHelper('formatrxByte', function(rxByte, options){
            var c = /\d{1,3}(?=(\d{3})+(\.\d*)?$)/g;
            var r_rxByte = String(rxByte).replace(c, "$&,")+"bytes";
            return r_rxByte;
        }); 
        Ember.Handlebars.registerBoundHelper('formatrxByteRate', function(rxByteRate, options){
            var r_rxByteRate = APM.util.flowFormatter(rxByteRate);
            return r_rxByteRate==0?0:r_rxByteRate.toString().replace("B","")+"bps";
        });       
        APM.ConfigSysinfoView = ConfigSysinfoView;
        return ConfigSysinfoView;
    }
);